<template>
  <div v-show="dialogValue" class="add-form f-c">
    <el-button style="position:absolute;right: 20px;top: 20px;z-index: 99" @click="onPageBack">返回</el-button>
    <el-tabs v-model="activeName" class="audit-tabs" type="card">
      <el-tab-pane label="评审前" name="First" />
      <el-tab-pane label="评审中" name="Middle" />
      <el-tab-pane label="评审后" name="After" />
    </el-tabs>
    <component :is="activeName" v-if="dialogValue" :current-detail="currentDetail" @success="onSuccess" />
  </div>
</template>

<script>
import First from './first'
import Middle from './middle'
import After from './after'

export default {
  name: 'FormAdd',
  components: {
    First,
    Middle,
    After
  },
  data() {
    return {
      dialogValue: false,
      currentDetail: {},
      activeName: 'First'
    }
  },
  created() {

  },
  methods: {
    open(item) {
      this.currentDetail = item
      this.dialogValue = true
    },
    onPageBack() {
      this.dialogValue = false
    },
    onSuccess() {
      console.log(this.activeName);
      if (this.activeName === 'Middle'){
        this.activeName = "After"
      } else if (this.activeName === 'After'){
        this.$router.replace('/project/center')
      } else {
        this.$emit('get-page')
        this.dialogValue = false
      }
    }
  }
}
</script>

<style lang="scss">
</style>
